<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>汽车金融贷款工具</title>
    <link rel="stylesheet" href="styles.css">
</head>
<body>
    <div class="container">
        <header>
            <h1>🚗 汽车金融贷款工具</h1>
            <p>专业的还款计划生成与阶梯贷方案对比分析</p>
        </header>

        <div class="main-content">
            <!-- 常规贷款信息输入 -->
            <div class="input-section">
                <h2>常规贷款信息</h2>
                <div class="form-row">
                    <div class="form-group">
                        <label for="loanAmount">贷款金额（元）</label>
                        <input type="number" id="loanAmount" placeholder="请输入贷款金额" min="1000" step="1000" value="40000">
                    </div>
                    <div class="form-group">
                        <label for="annualRate">年化利率（%）</label>
                        <input type="number" id="annualRate" placeholder="请输入年化利率" min="0.1" step="0.01" value="15.20">
                    </div>
                    <div class="form-group">
                        <label for="repaymentMethod">还款方式</label>
                        <select id="repaymentMethod">
                            <option value="equal">等额本息</option>
                            <option value="principal">等额本金</option>
                        </select>
                    </div>
                    <div class="form-group">
                        <label for="loanTerm">贷款期限（年）</label>
                        <input type="number" id="loanTerm" value="3" readonly>
                    </div>
                    <div class="form-group button-group">
                        <button id="generatePlan" class="btn btn-primary">生成还款计划</button>
                    </div>
                </div>
            </div>

            <!-- 阶梯贷设置 -->
            <div class="input-section">
                <h2>阶梯贷方案设置</h2>
                <div class="form-row-2">
                    <div class="form-group">
                        <label for="stepType">阶梯类别</label>
                        <select id="stepType">
                            <option value="two" selected>两阶-前两年和后一年</option>
                            <option value="three">三阶-每年为一阶</option>
                        </select>
                    </div>
                    <div class="form-group">
                        <label for="stepRatio">阶梯本金还款比例（10分制）</label>
                        <input type="text" id="stepRatio" placeholder="请输入阶梯本金还款比例" value="8.00:2.00">
                    </div>
                    <div class="form-group">
                        <label for="stepAnnualRate">阶梯贷年化利率（%）</label>
                        <input type="number" id="stepAnnualRate" placeholder="请输入阶梯贷年化利率" min="0.1" step="0.01" value="18.06">
                    </div>
                    <div class="form-group button-group">
                        <button id="generateStepPlan" class="btn btn-secondary">生成阶梯贷方案</button>
                    </div>
                </div>
            </div>

            <!-- 还款计划显示区域 -->
            <div class="plans-container">
                <!-- 原方案 -->
                <div class="plan-section">
                    <h3>常规贷款方案</h3>
                    <div id="originalPlan" class="plan-content">
                        <p class="no-data">请先生成还款计划</p>
                    </div>
                    <div class="plan-controls" style="display: none;">
                        <button class="btn btn-outline expand-btn" onclick="togglePlanDisplay('originalPlan')">
                            <span class="expand-text">展开全部</span>
                            <span class="expand-icon">▼</span>
                        </button>
                    </div>
                </div>

                <!-- 阶梯贷方案 -->
                <div class="plan-section">
                    <h3>阶梯贷方案</h3>
                    <div id="stepPlan" class="plan-content">
                        <p class="no-data">请先生成阶梯贷方案</p>
                    </div>
                    <div class="plan-controls" style="display: none;">
                        <button class="btn btn-outline expand-btn" onclick="togglePlanDisplay('stepPlan')">
                            <span class="expand-text">展开全部</span>
                            <span class="expand-icon">▼</span>
                        </button>
                    </div>
                </div>
            </div>

            <!-- 对比分析按钮 -->
            <div class="analysis-section">
                <button id="compareAnalysis" class="btn btn-success" disabled>对比分析</button>
                <button id="downloadBtn" class="btn btn-info">打印方案</button>
            </div>

            <!-- 对比分析结果 -->
            <div id="comparisonSection" style="display: none;">
                <div id="comparisonResult">
                    <!-- 对比结果将在这里显示 -->
                </div>
            </div>
        </div>
    </div>

    <script src="script.js"></script>
</body>
</html>
